﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using eSchoolbag.Utility;

namespace eSchoolbag
{
	/// <summary>
	/// Interaction logic for ConfigWindow.xaml
	/// </summary>
	public partial class ConfigWindow : Window
	{
		private URLProvider _URLProvider = new URLProvider();

		public ConfigWindow()
		{
			InitializeComponent();
		}

		private void Window_Activated(object sender, EventArgs e)
		{
			txtURL1.Text = _URLProvider.URL1;
			txtURL2.Text = _URLProvider.URL2;
		}

		private void btnOK_Click(object sender, RoutedEventArgs e)
		{
			if (!txtURL1.Text.StartsWith("http://"))
				txtURL1.Text = "http://" + txtURL1.Text;
			if (!txtURL2.Text.StartsWith("http://"))
				txtURL2.Text = "http://" + txtURL2.Text;

			_URLProvider.URL1 = txtURL1.Text;
			_URLProvider.URL2 = txtURL2.Text;

			this.DialogResult = true;
		}
	}
}
